<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>物流发货管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});


		function heji(){
		    var driverFreight = $('#driverFreight').val();
            var insuranceFee = $('#insuranceFee').val();
            var taxPoiint = $('#taxPoiint').val();
            var ticheng = $('#ticheng').val();
            var freight =  Number(driverFreight)+Number(insuranceFee)+Number(driverFreight/100)*taxPoiint+Number(ticheng);
            $('#freight').val(freight);

            var reward = Number(ticheng/100)*25;
            $('#reward').val(reward);//下单奖励金总数 提成的25%
			var commission = Number(ticheng/100)*60;
            $('#commission').val(commission);//合伙人佣金（提成的60%）
			var profit = Number(ticheng) - Number(reward) - Number(commission) -10;
            $('#profit').val(profit);//预估利润
		}


	</script>
	<style type="text/css">
		img{
			cursor: pointer;
			transition: all 0.6s;
		}
		img:hover{
			transform: scale(2.2);
		}

	</style>
</head>

<body class="hideScroll">
		<form:form id="inputForm" modelAttribute="logisDelivery" action="${ctx}/logis/logisDelivery/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right">工场发货人：</label></td>
					<td class="width-35">
						<form:input path="consignerName" htmlEscape="false"  readonly="true"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">发货人手机：</label></td>
					<td class="width-35">
						<form:input path="consignerMobile" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">发货省市：</label></td>
					<td class="width-35">
							${logisDelivery.startProvince}${logisDelivery.startCity}${logisDelivery.startDistrict}
					</td>
					<td class="width-15 active"><label class="pull-right">发货详细地址：</label></td>
					<td class="width-35">
						<form:input path="startAddress" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">收货省市：</label></td>
					<td class="width-35">
							${logisDelivery.endProvince}${logisDelivery.endCity}${logisDelivery.endDistrict}
					</td>
					<td class="width-15 active"><label class="pull-right">收货详细地址：</label></td>
					<td class="width-35">
						<form:input path="endAddress" htmlEscape="false"    class="form-control"/>
					</td>
				</tr>


				<tr>
					<td class="width-15 active"><label class="pull-right">收货人名称：</label></td>
					<td class="width-35">
						<form:input path="receiverName" htmlEscape="false"  readonly="true"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">收货人手机号：</label></td>
					<td class="width-35">
						<form:input path="receiverMobile" htmlEscape="false" readonly="true"    class="form-control "/>
					</td>
				</tr>

				<tr>
					<td class="width-15 active"><label class="pull-right">运输人：</label></td>
					<td class="width-35">
						<form:input path="carrierName" htmlEscape="false"  readonly="true"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">运输人手机：</label></td>
					<td class="width-35">
						<form:input path="carrierMobile" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
				</tr>

				<tr>
					<td class="width-15 active"><label class="pull-right">货物名称<font color="red">*</font>：</label></td>
					<td class="width-35">
						<form:input path="goodsName" htmlEscape="false"    class="form-control required"/>
					</td>
					<td class="width-15 active"><label class="pull-right">是否整车：</label></td>
					<td class="width-35">
						<form:input path="wholeCar" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">预估货物重量(吨)：</label></td>
					<td class="width-35">
						<form:input path="estimateWeight" htmlEscape="false"  placeholder="预估货物重量" class="form-control number required"/>
					</td>
					<td class="width-15 active"><label class="pull-right">预估货物体积(立方米)：</label></td>
					<td class="width-35">
						<form:input path="estimateVolume" htmlEscape="false"     class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货物重量(吨)：</label></td>
					<td class="width-35">
						<form:input path="goodsWeight" htmlEscape="false"  placeholder="司机端装货后过磅输入" class="form-control number"/>
					</td>
					<td class="width-15 active"><label class="pull-right">货物体积(立方米)：</label></td>
					<td class="width-35">
						<form:input path="goodsVolume" htmlEscape="false"     class="form-control "/>
					</td>

				</tr>
				<tr>

					<td class="width-15 active"><label class="pull-right">运输单价(司机)<font color="red">*</font>：</label></td>
					<td class="width-35">
						<form:input path="driverUnitPrice" htmlEscape="false"  placeholder="元/吨，客服输入"   class="form-control required number"/>
					</td>
					<td class="width-15 active"><label class="pull-right">运输单价(货主)<font color="red">*</font>：</label></td>
					<td class="width-35">
						<form:input path="ownerUnitPrice" htmlEscape="false"  placeholder="元/吨，客服输入"  class="form-control required number"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">司机端运费(元)：</label></td>
					<td class="width-35">
						<form:input path="driverFreight" htmlEscape="false"  readonly="true" placeholder="货物重量X司机端运输单价"  class="form-control" />
					</td>

					<td class="width-15 active"><label class="pull-right">货主端运费(元)：</label></td>
					<td class="width-35">
						<form:input path="ownerFreight" htmlEscape="false"  readonly="true" placeholder="货物重量X货主端运输单价"  class="form-control" />
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">距离(公里数)：</label></td>
					<td class="width-35">
						<form:input path="distance" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">装车时间：</label></td>
					<td class="width-35">
						<form:input path="loadTimeText" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-15 active"><label class="pull-right">货物图片：</label></td>
					<td class="width-35" colspan="3">
						<c:forEach items="${logisDelivery.goodsPicList}" var="goodPic">
							<img src="${goodPic.picUrl}" width="200px">
						</c:forEach>
					</td>

				</tr>



				<tr>
					<td class="width-15 active"><label class="pull-right">保险费(元)<font color="red">*</font>：</label></td>
					<td class="width-35">
						<form:input path="insuranceFee" htmlEscape="false"     class="form-control number required" />
					</td>

					<td class="width-15 active"><label class="pull-right">发票税点(%)<font color="red">*</font>：</label></td>
					<td class="width-35">
						<form:select path="taxPoiint" class="form-control">
							<form:options items="${fns:getDictList('logis_tax_point')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货主合计总费(元)：</label></td>
					<td class="width-35">
						<form:input path="freight" htmlEscape="false" readonly="true"  placeholder="货主需要支付的总费用"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">预支付订金(元)<font color="red">*</font>：</label></td>
					<td class="width-35">
						<c:if test="${logisDelivery.payStatus ne '0' }">
						<form:input path="deposit" htmlEscape="false" readonly="true"  class="form-control number required"/>
						</c:if>
						<c:if test="${logisDelivery.payStatus eq '0' }">
							<form:input path="deposit" htmlEscape="false"  class="form-control number required"/>
						</c:if>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">奖励金(元)：</label></td>
					<td class="width-35">
						<form:input path="reward" htmlEscape="false" readonly="true"     class="form-control number"/>
					</td>
					<td class="width-15 active"><label class="pull-right">合伙人佣金(元)：</label></td>
					<td class="width-35">
						<form:input path="commission" htmlEscape="false" readonly="true"   class="form-control number"/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">上级司机奖励(元)：</label></td>
					<td class="width-35">
						<form:input path="driverReward" htmlEscape="false" readonly="true"  value="10"   class="form-control number"/>
					</td>
					<td class="width-15 active"><label class="pull-right">预估利润(元)：</label></td>
					<td class="width-35">
						<form:input path="profit" htmlEscape="false" readonly="true"   class="form-control number"/>
					</td>
				</tr>

				<tr>

					<td class="width-15 active"><label class="pull-right">运输协议：</label></td>
					<td class="width-35">
						<form:input path="ysxy" htmlEscape="false" readonly="true"     class="form-control"/>
					</td>
					<td class="width-15 active"><label class="pull-right">货物保险：</label></td>
					<td class="width-35">
						<form:input path="hwbx" htmlEscape="false" readonly="true"    class="form-control"/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">下单奖励金：</label></td>
					<td class="width-35">
						${logisDelivery.reward}(元)
					</td>
					<td class="width-15 active"><label class="pull-right">耗时：</label></td>
					<td class="width-35">
						物流耗时${logisDelivery.consumeTime}|支付剩余时间订金:${logisDelivery.leftPayTime}|司机接单剩余时间:${logisDelivery.leftDriverTime}
					</td>
				</tr>
		   		<tr>
					<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
					<td class="width-35">
						<form:input path="remarks" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">当前状态：</label></td>
					<td class="width-35">
							${fns:getDictLabel(logisDelivery.status, 'logis_delivery_status', '')}

					</td>

				</tr>

		 	</tbody>
		</table>
	</form:form>
</body>
</html>